﻿package net.wangit.view.enumeration;

import net.wangit.MapList;
import net.wangit.Row;
import net.wangit.context.ActionContext;
import net.wangit.framework.expression.LabelExpression;
import net.wangit.util.Checker;

public class EnumerationHelper {

	public EnumerationHelper() {
	}

	public static MapList resolve(ActionContext ac, MapList list) {
		if (Checker.isEmpty(list))
			return list;
		MapList result = new MapList();
		for (int i = 0; i < list.size(); i++) {
			Row row = list.getRow(i);
			String name = row.get("name");
			name = LabelExpression.resolve(ac, name);
			result.put(i, "name", name);
			result.put(i, "value", row.get("value"));
			result.put(i, "custom", row.get("custom"));
		}

		return result;
	}
}
